;; -*- coding: utf-8 -*-
(defvar after-make-console-frame-hooks '()
  "Hooks to run after creating a new TTY frame")
(defvar after-make-window-system-frame-hooks '()
  "Hooks to run after creating a new window-system frame")

(defun run-after-make-frame-hooks (frame)
  "Selectively run either `after-make-console-frame-hooks' or
`after-make-window-system-frame-hooks'"
  (select-frame frame)
  (run-hooks (if window-system
                 'after-make-window-system-frame-hooks
               'after-make-console-frame-hooks)))

(add-hook 'after-make-frame-functions 'run-after-make-frame-hooks)

(when (fboundp 'tool-bar-mode)
  (tool-bar-mode -1))
(when (fboundp 'menu-bar-mode)
  (menu-bar-mode -1))
(when (fboundp 'set-scroll-bar-mode)
  (set-scroll-bar-mode nil))

;; visual-line
(global-visual-line-mode 1)

;; 自动换行
(defun truncate-line()
  (interactive)
  (progn
    (toggle-truncate-lines)
    (redraw-display)))

(global-set-key (kbd "M-q") 'truncate-line)

;; Display time & date
(setq frame-title-format
      (list "%f (%m) : %b @ " system-name))

(display-time-mode -1)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)

(provide 'init-frame-hooks)
